import Excel.ExcelOperator;
import Excel.Model.ColumnModel;
import Excel.Model.SheetModel;
import Excel.Model.WorkBookModel;

import java.io.IOException;

public class ExcelApplication {
    public static void main(String[] args) throws IOException {
        final int sheetCount = 6;
        final int columnCount = 4;
        WorkBookModel workBookModel = new WorkBookModel();
        workBookModel.setFileName("hhhh");
        workBookModel.setNoSign(true);
        workBookModel.setUseName("云警");
        SheetModel[] sheetModels = new SheetModel[sheetCount];

        ColumnModel[] columnModels = new ColumnModel[columnCount];
        for (int i = 0; i < columnCount; i++) {
            ColumnModel columnModel = new ColumnModel();
            columnModel.setColumnName("C" + i);
            if (i == 0)
                columnModel.setTextSite((byte) -1);
            if (i == columnCount - 1) {
                columnModel.setDataType((byte) 1);
            }
            if (i == columnCount) {
                columnModel.setTextSite((byte) 1);
                columnModel.setDataType((byte) 2);
            }
            columnModels[i] = columnModel;
        }

        final int rowCount = 50;
        Object[][] dataArray = new Object[rowCount][columnCount];
        for (int i = 0; i < rowCount; i++) {
            Object[] row = new Object[columnCount];
            for (int j = 0; j < columnCount; j++) {
                if (j < columnCount - 1)
                    row[j] = String.format("%d:%d,conconc", i, j);
                else
                    row[j] = i + j;
            }
            dataArray[i] = row;
        }

        Object[] totalArray = new Object[columnCount];
        totalArray[columnCount - 1] = 100;

        for (int i = 0; i < sheetModels.length; i++) {
            SheetModel sheetModel = new SheetModel();
            sheetModel.setSheetName("Sheet" + i);
            sheetModel.setSheetTitle("SheetTitle" + i);
            sheetModel.setColumnModels(columnModels);
            sheetModel.setRemark("Remark" + i);
            sheetModel.setDataArray(dataArray);
            sheetModel.setTotalSign(i % 2 == 1 ? true : false);
            if (sheetModel.isTotalSign())
                sheetModel.setTotalArray(totalArray);
            sheetModels[i] = sheetModel;
        }

        workBookModel.setSheetModels(sheetModels);
        ExcelOperator excelOperator = new ExcelOperator();
        excelOperator.setWorkBookModel(workBookModel);
        excelOperator.setPath("D:\\some");
        final String s = excelOperator.toExcel(String.class,null);
        System.out.println(s);
    }
}
